<template>
  <div>
    <div class="search">
      <div class="location" @click="getLocation">
        {{ city }}
        <van-icon class="icon" name="arrow-down">
          <span class="gun">|</span>
        </van-icon>
      </div>
      <van-search placeholder="请输入搜索关键词" />
      <van-icon name="guide-o" class="map" color="#fff" />
    </div>
  </div>
</template>

<script>
export default {
  name: "search-page",
  components: {},
  props: {},
  data() {
    return {
      city: localStorage.getItem("city")
        ? localStorage.getItem("city")
        : "上海",
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    getLocation() {
      this.$router.push("/location");
    },
  },
};
</script>

<style scoped lang="less">
.search {
  .location {
    border-radius: 3px 0 0 3px;
    position: absolute;
    height: 34px;
    width: 64px;
    background-color: #f7f8fa;
    color: #333;
    z-index: 222;
    transform: translate(-50%, -50%);
    left: 15%;
    top: 9%;
    line-height: 34px;
    text-align: left;
    font-size: 14px;
    padding: 0 6px;
    .icon {
      font-size: 12px;
    }
  }
  .van-search {
    border-radius: 0 3px 3px 0;
    position: absolute;
    z-index: 222;
    padding: 0;
    transform: translate(-50%, -50%);
    left: 55%;
    top: 9%;
    width: 230px;
  }
}
.map {
  position: absolute;
  z-index: 222;
  transform: translate(-50%, -50%);
  left: 90%;
  top: 8%;
  width: 20px;
  height: 20px;
  font-size: 30px;
}
.gun {
  font-size: 20px;
  margin-left: 10px;
  color: #eee;
}
</style>
